﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Shared/_LayuiMobileList.cshtml";
}

<style type="text/css">
    .layui-table-cell {
        height: auto;
        line-height: 35px;
    }

</style>

<form class="layui-form">
    <input style="display: none" id="listid" value="@ViewBag.ListId">
    <input style="display: none" id="fwid" value="@ViewBag.FwId">
    <div class="layui-tab" lay-filter="tabTag_Filter">
        <ul class="layui-tab-title">
            <li class="layui-this" lay-id="1">流程记录</li>
            <li lay-id="2">操作记录</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <table class="layui-hide" id="tableId" lay-filter="tableFilter"></table>
            </div>
            <div class="layui-tab-item">
                <table class="layui-hide" id="tableId02" lay-filter="tableFilter"></table>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="text-align: center;">
        <div class="layui-btn-container">
            <button type="button" class="layui-btn layui-btn-primary" id="close">关闭</button>
        </div>
    </div>
</form>

<script src="~/lib/layui/layui.js" charset="utf-8"></script>
<script>
    layui.use(["table", "element", "form", "exLayer", "exUtils"], function () {
        let table = layui.table;
        let form = layui.form;
        let exLayer = layui.exLayer;
        let exUtils = layui.exUtils;
        let element = layui.element;

        let $ = layui.$;
        element.on('tab(tabTag_Filter)', function (data) {

        });

        form.render();

        let ThisTable = table.render({
            elem: "#tableId",
            url: "/SysFlow/FlowRunList/GetFlowRunPrcsList?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val(),
            toolbar: "#toolbarTpl",
            defaultToolbar: [{ title: '刷新', layEvent: 'refresh', icon: 'layui-bg-blue layui-icon-refresh' }],
            cols: [[
                { templet: "#mobile_list" }
            ]],
            done: function (res, curr, count) {
                if (count == -1) {
                    layer.msg(res.msg, { icon: 5, time: 20000, btn: ['关闭'] });//显示错误
                }
            },
            text: {
                none: '无记录'
            }
        });

        let ThisTable02 = table.render({
            elem: "#tableId02",
            url: "/SysFlow/FlowRunList/GetFlowRunRecord?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val(),
            toolbar: "#toolbarTpl",
            defaultToolbar: [{ title: '刷新', layEvent: 'refresh2', icon: 'layui-bg-blue layui-icon-refresh' }],
            cols: [[
                { templet: "#mobile_list2" }
            ]],
            done: function (res, curr, count) {
                if (count == -1) {
                    layer.msg(res.msg, { icon: 5, time: 20000, btn: ['关闭'] });//显示错误
                }
            },
            text: {
                none: '无记录'
            }
        });

        table.on("toolbar(tableFilter)", function (obj) {
            switch (obj.event) {
                case "refresh":
                    ThisTable.reload({
                        url: "/SysFlow/FlowRunList/GetFlowRunPrcsList?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val()
                    });
                    break;
                case "refresh2":
                    ThisTable02.reload({
                        url: "/SysFlow/FlowRunList/GetFlowRunRecord?listid=" + $("#listid").val() + "&fwid=" + $("#fwid").val()
                    });
                    break;
            }
        });

        //关闭
        $('#close').on('click', function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        });
    });
</script>

<!-- 行工具栏模板 -->
<script type='text/html' id='mobile_list'>
    <div class='layui-tab-content'>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>流程步骤： {{d.FlowPrcs ==  null ? '' : d.FlowPrcs}}</div>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>状态：
          {{#  if(d.runFlag == '1'){ }}
               <span style='color: #FE7300;'>待接手</span>
          {{#  } }}
          {{#  if(d.runFlag == '2'){ }}
               <span style='color: blue;'>办理中</span>
          {{#  } }}
          {{#  if(d.runFlag == '3'){ }}
               <span>已办结</span>
          {{#  } }}
        </div>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>接手：
            {{#  if(d.beginUserId != null){ }}
               <span>{{d.beginUserId}} {{d.createTime}}</span>
            {{#  }else{ }}
            {{#  } }}
        </div>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>转交：
             {{#  if(d.deliverUserId != null){ }}
                <span>{{d.deliverUserId}} {{d.deliverTime}}</span>
             {{#  }else{ }}
             {{#  } }}
         </div>
     <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;overflow:visible;text-overflow:inherit;white-space:normal;'>详细： {{d.stepInfo ==  null ? '' : d.stepInfo}}</div>
     <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;overflow:visible;text-overflow:inherit;white-space:normal;'>转交意见： {{d.deliverComments ==  null ? '' : d.deliverComments}}</div>
    </div>
</script>
<script type='text/html' id='mobile_list2'>
    <div class='layui-tab-content'>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>用户： {{d.OperatePerson ==  null ? '' : d.OperatePerson}}</div>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;'>时间： {{d.OperateTime ==  null ? '' : d.OperateTime}}</div>
        <div class='layui-table-cell' style='margin-left:-30px;margin-right: -30px;overflow:visible;text-overflow:inherit;white-space:normal;'>操作： {{d.Info ==  null ? '' : d.Info}}</div>
    </div>
</script>